@if(count($datas))
@foreach($datas as $data)
<div class="am-panel-bd">
    <div class="am-g">
        <div class="am-u-md-12">
            <div class="am-panel am-panel-default" style="
                    height:{{ceil(count($data->subs)/3)*80+40}}px;
                    ">
                <div class="am-panel-hd">
                    {{$data->name}}
                    {{--@if($data->del)【已删除】@endif--}}
                    <div class="am-btn-group am-btn-group-xs am-fr">
                        <div class="am-btn-group am-btn-group-xs am-fr">
                            <a href="{{$prefix_url}}/{{$data->id}}/edit/?pid={{$data->pid}}" class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                <span class="am-icon-edit"></span>
                                编辑
                            </a>
                            {{--<button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="window.location.href='{{$prefix_url}}/del/{{$data->id}}';"><span class="am-icon-trash-o"></span> 删除</button>--}}
                        </div>
                    </div>
                </div>
                <br>
                @if($subs=$data->subs)
                    @foreach($subs as $sub)
                        <div class="am-u-md-4 am-u-end">
                            <div class="am-panel am-panel-default">
                                <div class="am-panel-hd">
                                    <a href="javascript:;">
                                        @if(mb_strlen($sub->name)>4)
                                            {{mb_substr($sub->name,0,4).'...'}}
                                        @else
                                            {{$sub->name}}
                                        @endif
                                        {{--@if($sub->del)【已删除】@endif--}}
                                    </a>
                                    <div class="am-btn-group am-btn-group-xs am-fr">
                                        <a href="{{$prefix_url}}/{{$sub->id}}/edit/?pid={{$sub->pid}}"
                                           class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                            <span class="am-icon-edit"></span>
                                            编辑
                                        </a>
                                        @if($sub->del)
                                        <a href="javascript:;"
                                           onclick="setDelRedo({{$sub->id}})"
                                           class="am-btn am-btn-default
                                           am-btn-xs am-text-secondary">
                                            <b>还原</b>
                                        </a>
                                        @else
                                        <a href="javascript:;"
                                           onclick="setDel({{$sub->id}})"
                                           class="am-btn am-btn-default
                                           am-btn-xs am-text-secondary">
                                            <b>删除</b>
                                        </a>
                                        @endif
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endforeach
                @endif
            </div>
        </div>
    </div>
</div>
@endforeach
@endif


<script type="text/javascript">
    function setDel(id){
        window.location.href = '/mcadmin/basic/auth/action/del?id='+id+'&oper=1';
    }
    function setDelRedo(id){
        window.location.href = '/mcadmin/basic/auth/action/del?id='+id+'&oper=2';
    }
</script>